# cmake 最低版本需求

cmake_minimum_required(VERSION 2.8.3)
# 工程名称
project(IPA_CCPP)

# 设置
set(CMAKE_CXX_STANDARD 11)
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")



find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS system chrono thread)

find_package(Eigen3)
if(NOT EIGEN3_FOUND)
    # Fallback to cmake_modules
    find_package(cmake_modules REQUIRED)
    find_package(Eigen REQUIRED)
    set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
    set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES})  # Not strictly necessary as Eigen is head only
    # Possibly map additional variables to the EIGEN3_ prefix.
else()
    set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()

# find_package(GUROBI) 
# # if Gurobi was found, set a flag to use it
# if(GUROBI_FOUND)
# 	add_definitions(-DGUROBI_FOUND=${GUROBI_FOUND})
# endif(GUROBI_FOUND)


include_directories( 
    include
	${OpenCV_INCLUDE_DIRS}
	${Boost_INCLUDE_DIRS}
    ${EIGEN3_INCLUDE_DIRS}
)

	# ${GUROBI_INCLUDE_DIRS}
	# ${CoinUtils_INCLUDE_DIRS}
	# ${OsiClp_INCLUDE_DIRS}
	# ${Clp_INCLUDE_DIRS}
	# ${Osi_INCLUDE_DIRS}
	# ${Cgl_INCLUDE_DIRS}
    # ${Cbc-lib_INCLUDE_DIRS}  )
    



add_subdirectory(lib_hybrid_A_star)

add_library(room_rotator  src/room_rotator.cpp  )

add_library(boustrophedon_explorator  
            src/boustrophedon_explorator.cpp   src/room_rotator.cpp  src/meanshift2d.cpp
      )
      target_link_libraries( boustrophedon_explorator
      hybrid_A_star_lib

      )

add_library(A_star_pathplanner  src/A_star_pathplanner.cpp  )
add_library(node  src/node.cpp  )
add_library(genetic_TSP  src/genetic_TSP.cpp  )
add_library(nearest_neighbor_TSP  src/nearest_neighbor_TSP.cpp  )
add_library(meanshift2d  src/meanshift2d.cpp  )


add_library(fov_to_robot_mapper  src/fov_to_robot_mapper.cpp  )
add_library(map_accessibility_analysis  src/map_accessibility_analysis.cpp  )



# 编译源码生成目标
add_executable(CCPP src/main.cpp)
target_link_libraries(CCPP
    meanshift2d
    room_rotator
    boustrophedon_explorator
    A_star_pathplanner
    node
    genetic_TSP
    nearest_neighbor_TSP
    fov_to_robot_mapper
    map_accessibility_analysis

    # cob_map_accessibility_analysis
    ${OpenCV_LIBS}
    ${Boost_LIBRARIES} )